package com.dp.order.util;

import com.dp.order.dto.BarCodeExport;
import com.dp.order.dto.ExportOddment;
import com.dp.order.dto.OutOrder;
import com.dp.order.entity.BarCode;
import com.dp.order.entity.Oddment;
import com.dp.order.entity.WorkOrder;
import org.springframework.cglib.beans.BeanCopier;

/**
 * @author linzizun
 * @version 1.0
 */
public class BeanCopyUtil {

    private static final BeanCopier Order_2_Work_Order = BeanCopier.create(OutOrder.class, WorkOrder.class, false);

    private static final BeanCopier Bar_Code_2_Bar_Code_Export = BeanCopier.create(BarCode.class, BarCodeExport.class, false);

    private static final BeanCopier Oddment_2_Export_Oddment = BeanCopier.create(Oddment.class, ExportOddment.class, false);

    public static void copy(OutOrder outOrder, WorkOrder workOrder) {
        Order_2_Work_Order.copy(outOrder, workOrder, null);
    }

    public static void copy(BarCode barCode, BarCodeExport barCodeExport) {
        Bar_Code_2_Bar_Code_Export.copy(barCode, barCodeExport, null);
    }

    public static void copy(Oddment oddment, ExportOddment exportOddment) {
        Oddment_2_Export_Oddment.copy(oddment, exportOddment, null);
    }

}
